package com.xiaolin.admin.valid;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import java.util.Arrays;
import java.util.List;

/**
 * @author xiaolin
 * @description 性别校验器
 * @since 2024/6/6
 */
public class GenderValidValidator implements ConstraintValidator<GenderValid, String> {
    @Override
    public boolean isValid(String value, ConstraintValidatorContext context) {
        List<String> genders = Arrays.asList("男", "女");
        return genders.contains(value);
    }
}
